#ifndef __PLATFORM_H__
#define __PLATFORM_H__

/*!!! include after "gui.h" !!!*/

#if defined(_WIN32) || defined(_MSC_VER)
#define __PLAT_WIN32__
#elif defined(__linux__) || defined(linux) || defined(__linux)
#define __PLAT_LINUX__
#else
#define __PLAT_X__
#endif

//namespace platform {

int                   init(int argc, char* argv[]);
void                  release();

class GForm;
enum  WindowType {WINDOW, VIEW,  DIALOG, TOOLBAR, TABBAR};
GHForm                createWindow(WindowType type, GForm* pForm);
void                  destroyWindow(GHForm handle);
void                  showWindow(GHForm, int);
void                  closeWindow(GHForm handle);
void                  setWindowFocus(GForm* pForm, bool focused = true);
GForm*                getFormHandle(GHForm handle);
void                  setFormHandle(GForm*, GHForm );
int                   messageLoop();
int                   sendToForm(const GForm* pRecv, const GMessage& msg);
long                  messageDispatch(GForm* pForm, const GMessage& msg);

void                  windowClientRect(const GForm* w, GRect& rc);
bool                  setWindowRect( GForm* w, const GRect& rc);
void                  setWindowCursor(GForm* pForm, GCursor::CursorShape cursor);
void                  repaintWindow(const GForm* pForm, const GRect& rc);
class GView;
void                  setGViewScroll(GView* pView, int type);
void                  scrollViewTo(GView* pView, int type,  int pos);

//////////////////////////////////////////////////////////////////////////

GHMenu                createMenu();
bool                  setWindowMenu(GForm* pWindow, GMenu menu);

void                  getShortCut(ShortCut& cs);
//}



#ifdef __PLAT_WIN32__
#include "platform_win32.h"
#define WM_INITWINDOW                 (WM_USER + 1)   //a message sent when entering message loop
#endif

#endif 
